	*** Program to switch between graph format for slides & paper
		capture program drop mycolors
		program mycolors 
			syntax anything
			if "`anything'"=="black"{
				global cb = "black"
				global cf = "gs12"	
				global cg = "gs0"
				global cg2 = "gs3"
				global c1 = "ebblue"		// midgreen
				global c2 = "cranberry"		// red
				global c3 = "eltblue"		// midblue
				global c4 = "eltgreen"
				global c5 = "edkblue"
				global cyaxis = "white"
			}
			if "`anything'"=="mono"{
				global cb = "white"
				global cf = "black"	
				global cg = "gs8"			// gs13
				global c1 = "black"			// navy
				global c2 = "gs8"			// maroon
				global c3 = "black"			// forest_green	
				global cyaxis = "white"
			}
			if "`anything'"=="white"{
				global cb = "white"
				global cf = "black"	
				global cg = "gs13"			// gs13
				global c1 = "navy"			// navy
				global c2 = "maroon"		// maroon
				global c3 = "forest_green"	// forest_green	
				global cyaxis = "white"
			}
			if "`anything'"=="economist"{
				global cb = "ebg"
				global cf = "black"	
				global cg = "gs10"
				global cg2 = "white"
				global c1 = "edkblue"		// midgreen
				global c2 = "emidblue"		// red
				global c3 = "erose"			// midblue
				global cyaxis = "ebg"
			}

		end

		global myylabel = "angle(0) noticks glcolor($cb) labcolor($cf)"			// glcolor($cg2)
		global myxlabel = "angle(0) tlcolor($cf) labcolor($cf)"
		global myregion = "plotregion(style(none) lcolor($cb)) graphregion(fcolor($cb) lcolor($cb))"
		global mylegend = "col(1) region(style(none)) color($cf)"

	*** Program to automatical set ranges on scatter plots
		capture program drop myrange
		program define myrange
			syntax varlist
			tokenize "`varlist'"
			reg `1' `2'
			keep if e(sample)
			local 	y 		= "`1'"
			local 	x 		= "`2'"
			sum		`y'
			global  max1 = r(max)
			global  min1 = r(min)
			sum 	`x'
			global  max2 = r(max)
			global  min2 = r(min)
			global 	max = max($max1,$max2)
			global  min = min($min1,$min2)
			
			*** For textwrapping marker labels
				capture drop `y'2
				gen		`y'2 	= `y' - ($max - $min)/20
			
			*** 45 degree line
				global 	N = _N + 2
				set 	obs $N
				gen		diagonal = $min - ($max - $min)/10 if _n==_N-1
				replace diagonal = $max + ($max - $min)/10 if _n==_N
			
			*** For marker label placement
				reg 	`y' `x'
				predict `y'hat
				capture drop over
				gen		over = `y'>`y'hat

		end
